<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2010 osCommerce

  Released under the GNU General Public License
*/

  if (!isset($process)) $process = false;
?>

<div class="cms"> <span class="inputRequirement" style="float: right;"><?php echo FORM_REQUIRED_INFORMATION; ?></span>
  <h3><?php echo NEW_ADDRESS_TITLE; ?></h3>
</div>
<div class="contentText">
  <?php
  if (ACCOUNT_GENDER == 'true') {
    $male = $female = false;
    if (isset($gender)) {
      $male = ($gender == 'm') ? true : false;
      $female = !$male;
    } elseif (isset($entry['entry_gender'])) {
      $male = ($entry['entry_gender'] == 'm') ? true : false;
      $female = !$male;
    }
?>
  <div class="contact-left mgt15 w150px"><?php echo ENTRY_GENDER; ?></div>
  <div class="mgt15 fl mgl15"> <?php echo tep_draw_radio_field('gender', 'm',$male) ?>
    <label for="male" class="mgr10">MALE</label>
    <?php echo tep_draw_radio_field('gender', 'f',$female) ?>
    <label for="female"> FEMALE</label>
    <?php (tep_not_null(ENTRY_GENDER_TEXT) ? '<div class="required fl">' . ENTRY_GENDER_TEXT . '</div>' : ''); ?>
  </div>
  <div class="spacer5"></div>
  <?php
  }
?>
  <div class="contact-left mgt15 w150px"><?php echo ENTRY_FIRST_NAME; ?></div>
  <div class="hinputbg fl"> <?php echo tep_draw_input_field('firstname',(isset($entry['entry_firstname']) ? $entry['entry_firstname'] : ''),'class="hinput"') ?> </div>
  <?php (tep_not_null(ENTRY_FIRST_NAME_TEXT) ? '<div class="required fl">' . ENTRY_FIRST_NAME_TEXT . '</div>' : ''); ?>
  <div class="spacer5"></div>
  <div class="contact-left mgt15 w150px"><?php echo ENTRY_LAST_NAME; ?></div>
  <div class="hinputbg fl"> <?php echo tep_draw_input_field('lastname',(isset($entry['entry_lastname']) ? $entry['entry_lastname'] : ''),'class="hinput"') ?> </div>
  <?php (tep_not_null(ENTRY_LAST_NAME_TEXT) ? '<div class="required fl">' . ENTRY_LAST_NAME_TEXT . '</div>' : ''); ?>
  <div class="spacer5"></div>
  <?php
  if (ACCOUNT_COMPANY == 'true') {
?>
  <div class="contact-left mgt15 w150px"><?php echo ENTRY_COMPANY; ?></div>
  <div class="hinputbg fl"><?php echo tep_draw_input_field('company',(isset($entry['entry_company']) ? $entry['entry_company'] : ''), 'class="hinput"'); ?></div>
  <?php (tep_not_null(ENTRY_COMPANY_TEXT) ? '<div class="required fl">' . ENTRY_COMPANY_TEXT . '</div>' : ''); ?>
  <div class="spacer5"></div>
  <?php
  }
?>
  <div class="contact-left mgt15 w150px"><?php echo ENTRY_STREET_ADDRESS; ?></div>
  <div class="hinputbg fl"> <?php echo tep_draw_input_field('street_address',(isset($entry['entry_street_address']) ? $entry['entry_street_address'] : ''), 'class="hinput"') ?> </div>
  <?php (tep_not_null(ENTRY_STREET_ADDRESS_TEXT) ? '<div class="required fl">' . ENTRY_STREET_ADDRESS_TEXT . '</div>' : ''); ?>
  <div class="spacer5"></div>
  <?php
  if (ACCOUNT_SUBURB == 'true') {
?>
  <div class="contact-left mgt15 w150px"><?php echo ENTRY_SUBURB; ?></div>
  <div class="hinputbg fl"> <?php echo tep_draw_input_field('suburb', (isset($entry['entry_suburb']) ? $entry['entry_suburb'] : ''), 'class="hinput"') ?> </div>
  <?php (tep_not_null(ENTRY_SUBURB_TEXT) ? '<div class="required fl">' . ENTRY_SUBURB_TEXT . '</div>' : ''); ?>
  <div class="spacer5"></div>
  <?php
  }
?>
  <div class="contact-left mgt15 w150px"><?php echo ENTRY_POST_CODE; ?></div>
  <div class="hinputbg fl"> <?php echo tep_draw_input_field('postcode',(isset($entry['entry_postcode']) ? $entry['entry_postcode'] : ''),'class="hinput"') ?> </div>
  <?php (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<div class="required fl">' . ENTRY_POST_CODE_TEXT . '</div>' : ''); ?>
  <div class="spacer5"></div>
  <div class="contact-left mgt15 w150px"><?php echo ENTRY_CITY; ?></div>
  <div class="hinputbg fl"> <?php echo tep_draw_input_field('city',(isset($entry['entry_city']) ? $entry['entry_city'] : ''), 'class="hinput"') ?> </div>
  <?php (tep_not_null(ENTRY_CITY_TEXT) ? '<div class="required fl">' . ENTRY_CITY_TEXT . '</div>' : ''); ?>
  <div class="spacer5"></div>
  <?php
  if (ACCOUNT_STATE == 'true') {
?>
  <div class="contact-left mgt15 w150px"><?php echo ENTRY_STATE; ?></div>
  <div class="hinputbg fl">
    <?php
                                if ($process == true) {
                                    if ($entry_state_has_zones == true) {
                                        $zones_array = array();
                                        $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int) $country . "' order by zone_name");
                                        while ($zones_values = tep_db_fetch_array($zones_query)) {
                                            $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
                                        }
                                        echo tep_draw_pull_down_menu('state', $zones_array, '', 'class="hinputcombo"');
                                    } else {
                                        echo tep_draw_input_field('state', '', 'class="hinput"');
                                    }
                                } else {
                                    echo tep_draw_input_field('state', (isset($entry['entry_country_id']) ? tep_get_zone_name($entry['entry_country_id'], $entry['entry_zone_id'], $entry['entry_state']) : ''), 'class="hinput"');
                                }
                                ?>
  </div>
  <?php (tep_not_null(ENTRY_STATE_TEXT) ? '<div class="required fl">' . ENTRY_STATE_TEXT . '</div>' : ''); ?>
  <div class="spacer5"></div>
  <?php
  }
?>
  <div class="contact-left mgt15 w150px"><?php echo ENTRY_COUNTRY; ?></div>
  <div class="hinputbg fl"> <?php echo tep_get_country_list('country',(isset($entry['entry_country_id']) ? $entry['entry_country_id'] : STORE_COUNTRY), 'class="hinputcombo"') ?> </div>
  <?php (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<div class="required fl">' . ENTRY_COUNTRY_TEXT . '</div>' : ''); ?>
  <div class="spacer15"></div>
  <?php
  if ((isset($HTTP_GET_VARS['edit']) && ($customer_default_address_id != $HTTP_GET_VARS['edit'])) || (isset($HTTP_GET_VARS['edit']) == false) ) {
?>
  <div class="contact-left mgt15 w150px">&nbsp;</div>
  <div class="mgl15 fl"> <?php echo tep_draw_checkbox_field('primary', 'on', false, 'id="primary"') . ' ' . SET_AS_PRIMARY; ?> </div>
  <div class="clear"></div>
  <?php
  }
?>
</div>
